import jieba.analyse

path = 'doupo.txt'
fp = open(path,'r')
content = fp.read()
try:
    jieba.analyse.set_stop_words('stopwords.txt')
    tags = jieba.analyse.extract_tags(content, topK=50, withWeight=True)
    for item in tags:
        print(item[0]+'\t'+str(int(item[1]*1000)))
finally:
    fp.close()